<script type="text/javascript">
function validate_form() {
    var name = $('#name').val();
    var phone = $('#phone').val();
    var nickname = $('#nickname').val();
    var countError = 0;
    
    if((name.length < 1) || (name.length > 50)) {
    	$('#errorName').html('Tên hỗ trợ từ 1-50 kí tự');
        countError++;
    }
    else {
        $('#errorName').html('');
    }
    if((phone.length < 1) || (phone.length > 15)) {
        $('#errorPhone').html('Điện thoại từ 1-15 kí tự');
        countError++;
    }
    else {
        $('#errorPhone').html('');
    }
    if((nickname.length < 1) || (nickname.length > 50)) {
        $('#errorNickname').html('Nickname từ 1-50 kí tự');
        countError++;
    }
    else {
        $('#errorNickname').html('');
    }
    
    if(countError > 0) {
        return false;
    }
    else {
        return true;
    }
}
</script>
    <div class="list_category">
        <ul>
            <li><a href="<?php echo $this->baseUrl('admincp/support'); ?>">Quản lý hỗ trợ online</a></li>
        </ul>
    </div>
</div>

<!-- Begin Content -->
<div class="section">
    <div class="heading_section">
        <span>Thêm hỗ trợ mới</span>
    </div>
    
    <div class="content">
    <form action="" method="post" onsubmit="return validate_form()">
        <table class="table">
            <tr>
                <td class="td1"><?php echo $this->formLabel('name','Tên hỗ trợ'); ?>&nbsp;<span class="error-msg">*</span></td>
                <td class="td2"><?php echo $this->formText('name',$this->nameValue,array('class'=>'input')); ?></td>
                <td class="td3" id="errorName"><?php echo $this->errorName; ?></td>
            </tr>
            <tr>
                <td class="td1"><?php echo $this->formLabel('phone','Điện thoại'); ?>&nbsp;<span class="error-msg">*</span></td>
                <td class="td2"><?php echo $this->formText('phone',$this->phoneValue,array('class'=>'input')); ?></td>
                <td class="td3" id="errorPhone"><?php echo $this->errorPhone; ?></td>
            </tr>
            <tr>
                <td class="td1"><?php echo $this->formLabel('type_nick','Loại'); ?>&nbsp;<span class="error-msg">*</span></td>
                <td class="td2">
                    <?php echo $this->formSelect('type_nick',$this->typeNickValue,
                        array('class'=>'selectbox'),
                        array('Yahoo'=>'Yahoo','Skype'=>'Skype'));
                    ?>
                </td>
                <td class="td3" id="errorTypeNick"><?php echo $this->errorTypeNick; ?></td>
            </tr>
            <tr>
                <td class="td1"><?php echo $this->formLabel('nickname','Nickname'); ?>&nbsp;<span class="error-msg">*</span></td>
                <td class="td2"><?php echo $this->formText('nickname',$this->nicknameValue,array('class'=>'input')); ?></td>
                <td class="td3" id="errorNickname"><?php echo $this->errorNickname; ?></td>
            </tr>
            <tr>
                <td class="td1">&nbsp;</td>
                <td class="td2">
                    <?php echo $this->formSubmit('submit','Thêm mới',array('class'=>'button')); ?>
                    <?php echo $this->formReset('reset','Nhập lại',array('class'=>'button')); ?>
                </td>
                <td class="td3"></td>
            </tr>
        </table>
    </form>
    </div>
</div>
<!-- End Content -->